{% extends base.html %}

{% block head %}
    <style type="text/css">
        .sys-cmd-no {
            width: 10%;
            max-width: 100px;
        }
        .sys-cmd {
            width: 70%;
        }
        .category {
            background: #ccf;
            padding: 5px;
        }
        a {
            text-decoration: none;
            color: #08c;
        }
        .item {
            width: 150px;
            height: 25px;
            float: left;
        }
    </style>
{% end %}

{% block body %}
<script type="text/javascript" src="/static/lib/string-format/string-format.min.js"></script>

<div class="barcode col-md-12" style="margin:0 auto;">
    {% if _has_login %}
        Hello, {{_user_name}}! <a href="/logout">登出</a>
    {% else %}
        Hello, 游客! <a href="/login">登陆</a>
    {% end %}
</div>

{% for category in xconfig.MENU_LIST %}
    {% if category.need_login and not _has_login %}
        {% continue %}
    {% end %}
    {% if category.need_admin and not _is_admin %}
        {% continue %}
    {% end %}
    <div class="col-md-12 top-offset-1">
        <h3 class="category">{{category.name}}</h3>
        <div class="col-md-12">
            {% for link in category.children %}
            <div class="item">
                <a href="{{link.url}}">{{link.name}}</a>
            </div>
            {% end %}
        </div>
    </div>
{% end %}

<div class="row top-offset-1">
    <hr/>
    当前时间: <span id="currentTime"></span>
</div>

<script type="text/javascript">
$(function () {
    function updateTime () {
        $("#currentTime").html(new Date().format("yyyy-MM-dd HH:mm:ss"));
        setTimeout(updateTime, 1000);
    }
    updateTime();
})


function runCommand(path) {
    // alert("runCommand "+ path);
    $.get("/system/command", {path: path}, function(data, status) {
        alert(data);
    })
}


</script>
{% end %}